package nickthissen.iracing.activities;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

import com.actionbarsherlock.app.SherlockActivity;

import nickthissen.iracing.iracingforum2.R;

/**
 * Created by Nick on 22-5-13.
 */
public class MaintenanceActivity extends SherlockActivity
{
    private static final String MESSAGE = "MESSAGE";

    @Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.maintenance);

        SherlockUtils.setNotificationBar(this);

        Intent i = this.getIntent();
        String message = i.getStringExtra(MESSAGE);

        TextView text = (TextView) this.findViewById(R.id.lblMaintenanceMessage);
        text.setText(message);

        Button btn = (Button) this.findViewById(R.id.btnClose);
        btn.setOnClickListener(new View.OnClickListener()
        {
            @Override
            public void onClick(View v)
            {
                close();
            }
        });

        this.getSupportActionBar().setTitle("iRacing Forum - Maintenance");
    }

    private void close()
    {
        finish();
    }

    public static Intent getIntent(Context context, String message)
    {
        Intent i = new Intent(context, MaintenanceActivity.class);
        i.putExtra(MESSAGE, message);
        return i;
    }
}
